package com.efast.cafe.portal.security.core;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;

public interface AuthenticationTypeService {
	
	/**
	 * 
	    * @Title: authentication
	    * @Description:构造UsernamePasswordAuthenticationToken
	    * @param @param request
	    * @param @return    参数
	    * @return UsernamePasswordAuthenticationToken    返回类型
	    * @throws
	 */
	public UsernamePasswordAuthenticationToken authentication(HttpServletRequest request);
	
	
	/**
	 * 
	    * @Title: onAuthenticationSuccess
	    * @Description: 登录成功后
	    * @param @param request
	    * @param @param response
	    * @param @param authentication
	    * @param @throws IOException
	    * @param @throws ServletException    参数
	    * @return void    返回类型
	    * @throws
	 */
	public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
			Authentication authentication)throws IOException, ServletException;
	
	/**
	 * 
	    * @Title: onAuthenticationFailure
	    * @Description: 登录失败后
	    * @param @param request
	    * @param @param response
	    * @param @param exception    参数
	    * @return void    返回类型
	    * @throws
	 */
	public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
			AuthenticationException exception)throws IOException, ServletException;
	
	/**
	 * 
	    * @Title: onLogoutSuccess
	    * @Description: 登出成功后
	    * @param @param request
	    * @param @param response
	    * @param @param authentication
	    * @param @throws IOException
	    * @param @throws ServletException    参数
	    * @return void    返回类型
	    * @throws
	 */
	public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, 
			Authentication authentication)throws IOException, ServletException;
}
